<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var a1 = prompt('请输入你的出生日期');
      var a2 = 2020 - a1;
      alert('你今年' +a2+ '岁啦');
    </script>
  </body>
</html>
